#include <54func.h>
int main(int argc,char *argv[])
{
    // ./4_homework_A 1.pipe
    ARGS_CHECK(argc,2);
    int fd = open(argv[1],O_WRONLY);
    ERROR_CHECK(fd,-1,"open");

    printf("Hello 1 !\n");
    int backupfd = 10;//做备份操作
    //重定向
    dup2(STDOUT_FILENO,backupfd);
    dup2(fd,STDOUT_FILENO);
    printf("Hello 2 !\n");
    dup2(backupfd,STDOUT_FILENO);
    printf("Hello 3 !\n");

    close(fd);
    return 0;
}
